package com.hsmpay.mobile.service.user;

import com.hsmpay.common.pojo.user.Person;
import com.hsmpay.common.pojo.user.User;
import com.hsmpay.common.service.MemcachedService;
import com.hsmpay.common.util.memcached.UserModel;
import com.hsmpay.mobile.pojo.user.ActivationHistory;

import java.io.Serializable;

/**
 * 用户业务接口 userService
 * 对应数据层 userDao
 *
 * @param <Entity>
 * @param <Query>
 * @author 颜铃璋
 * @date 2012-12-14
 */
public interface UserService<Entity extends Serializable, Query extends Object> extends MemcachedService<Entity, Query> {
    /**
     * 根据主键ID memcached 保存的用户 model
     *
     * @param userId
     * @return
     * @throws Exception
     */
    public UserModel getUserModelById(Long userId) throws Exception;

    /**
     * 根据注册码注册用户
     *
     * @param user
     * @param activationCode
     * @return
     */
    public Long register(User user, ActivationHistory activationHistory) throws Exception;

    /**
     * 根据userId 获得user
     *
     * @param userId
     * @return
     * @throws Exception
     */
    public User getUserById(Long userId) throws Exception;

    /**
     * 绑定银行卡
     *
     * @param user
     * @return
     * @throws Exception
     */
    public int bindingBankCard(User user) throws Exception;

    /**
     * 用户注销
     *
     * @param userId
     * @return
     * @throws Exception
     */
    public boolean userLogout(Long userId) throws Exception;

    /**
     * 修改密码
     *
     * @param user
     * @return
     * @throws Exception
     */
    public boolean updateUserPasseword(User user) throws Exception;

    /**
     * 更改产品类型（前端角色）
     *
     * @param user
     * @param activationHistory
     * @return
     * @throws Exception
     */
    public boolean updateAppRole(User user, ActivationHistory activationHistory) throws Exception;

    /**
     * 更新Info_Person表中的实名认证状态
     *
     * @param person
     * @param user
     * @return
     * @throws Exception
     */
    public int updateDPIStatus(Person person, User user) throws Exception;

    /**
     * 保存用户 到 Memcached
     *
     * @param user
     * @return
     * @throws Exception
     */
    public boolean saveMemcachedByUser(User user) throws Exception;


    /**
     * 根据 用户ID 从Memcached中取出用户   然后 根据登录时间 判断登录先后
     *
     * @param user
     * @return
     */
    public boolean isOldMemcachedUser(User user) throws Exception;

    /**
     * 根据登录名  查询用户
     *
     * @param loginName
     * @return
     * @throws Exception
     */
    public User searchUserByLoginName(String loginName) throws Exception;

    /**
     * 绑定刷卡器
     *
     * @param user
     * @return
     * @throws Exception
     */
    public int bindingMachine(User user) throws Exception;

    /**
     * 修改 提现类型
     *
     * @param user
     * @return
     * @throws Exception
     */
    public int updateCrashT1Type(User user) throws Exception;

    /**
     * 修改用户 为暂停结算 用户
     *
     * @param userId
     * @param description
     * @return
     * @throws Exception
     */
    public int updateRefuseClearStatus(Long userId, String description) throws Exception;

    /**
     * 修改用户  通道
     *
     * @param reqCode
     * @param userId
     * @return
     * @throws Exception
     */
    public int updateUserChannelId(String reqCode, Long userId) throws Exception;

}
